import {lazy, ReactNode} from  "react"
import { createFromIconfontCN } from '@ant-design/icons';
const MyIcon = createFromIconfontCN({
    scriptUrl: "//at.alicdn.com/t/c/font_2402710_ffno0awfcu.js", // 在 iconfont.cn 上生成
  });

let Login = lazy(() => import('@/pages/Login'))
let Page404 = lazy(() => import('@/pages/Page404'))
let PayManagerment = lazy(() => import('@/pages/PayManagerment'))
let PayType = lazy(() => import('@/pages/PayManagerment/PayType'))
let PictureManagerment = lazy(() => import('@/pages/PictureManagerment'))
let CarouselManagerment = lazy(() => import('@/pages/PictureManagerment/CarsouelManagerment'))
let ProductManagerment = lazy(() => import('@/pages/ProductManagerment'))
let ProductCategory = lazy(() => import('@/pages/ProductManagerment/ProductCategory'))
let ProductList = lazy(() => import('@/pages/ProductManagerment/ProductList'))
let TransactionManagerment = lazy(() => import('@/pages/TransactionManagerment'))
let Amount = lazy(() => import('@/pages/TransactionManagerment/Amount'))
let Order = lazy(() => import('@/pages/TransactionManagerment/Order'))
let Refund = lazy(() => import('@/pages/TransactionManagerment/Refund'))
let ContentBase=lazy(() => import('@/components/Layout/Content'))
type RouteObject={
    path: string;
    element?:ReactNode;
    children?:RouteObject[];
    label?:string;
    key?:any;
    icon?:ReactNode
}
const routes:RouteObject[]= [
    {
        path: "/login",
        element: <Login></Login>
    },
    {
        path: "*",
        element: <Page404 />
    },
    {
        path: "/",
        element: <ContentBase/>,
        children: [
            {
                path: "product",
                element: <ProductManagerment />,
                label: "商品管理",
                key: 'product',
                icon:<MyIcon type="icon-shangpinguanli"/>,
                children: [
                    {
                        path: 'category',
                        element: <ProductCategory />,
                        label: '产品类目',
                        key: 'category',
                        icon:<MyIcon type="icon-tubiaozhizuomoban" />,
                    },
                    {
                        path: 'productlist',
                        element: <ProductList />,
                        label: '产品列表',
                        key: 'productlist',
                        icon:<MyIcon type="icon-liebiao" />
                    }
                ]
            },
            {
                path: "picture",
                element: <PictureManagerment />,
                label: '图片管理',
                key: 'picture',
                icon: <MyIcon type="icon-tupian" />,
                children: [
                    {
                        path: 'carousel',
                        element: <CarouselManagerment />,
                        label: '轮播图管理',
                        key: 'carousel',
                        icon: <MyIcon type="icon-drxx70" />
                    }
                ]
            },
            {
                path: "transaction",
                element: <TransactionManagerment />,
                label: '交易管理',
                key: 'transaction',
                icon: <MyIcon type="icon-biaoqiankuozhan_jiaoyi-195" />,
                children: [
                    {
                        path: "amount",
                        element: <Amount />,
                        label: '交易金额',
                        key: 'amount',
                        icon: <MyIcon type="icon-icon_A" />
                    },
                    {
                        path: 'order',
                        element: <Order />,
                        label: '订单管理',
                        key: 'order',
                        icon: <MyIcon type="icon-cangpeitubiao_dingdan" />
                    },
                    {
                        path: 'refund',
                        element: <Refund />,
                        label: '退款管理',
                        key: 'refund',
                        icon: <MyIcon type="icon-tuikuan" />
                    }
                ]
            },
            {
                path: "payment",
                element: <PayManagerment />,
                label: '支付管理',
                key: 'payment',
                icon: <MyIcon type="icon-ziyuan" />,
                children: [
                    {
                        path: "paytype",
                        element: <PayType />,
                        label: '支付类型',
                        key: 'paytype',
                        icon:<MyIcon type = "icon-zhifu" />
                    }
                ]
            }
        ]
    }
]

export default routes